<?php

class GoogleAds extends AdBlock {

    /**

     * Returns the static model of the specified AR class.

     * @param string $className active record class name.

     * @return User the static model class

     */
    public static function model($className = __CLASS__) {

        return parent::model($className);
    }

    public function defaultScope() {

        return array(
            'condition' => "t.type = 'google_ads'"
        );
    }

    public function beforeSave() {

        if (parent::beforeSave()) {

            $this->type = 'google_ads';

            return true;
        }

        return false;
    }

    public function beforeValidate() {

        $this->type = 'google_ads';

        parent::beforeValidate();



        return true;
    }

    public function getPositionText() {

        switch ($this->position) {

            case 'home_right' :

                $return = 'Home page';

                break;

            case 'bottom' :

                $return = 'bottom';

                break;

            case 'right' :

                $return = 'Right sidebar';

                break;

            default:

                $return = '';

                break;
        }



        return $return;
    }

}